package com.edu.compile.util;

import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;

/**
 * @author yanzhao
 * @date 2021/10/19 16:52
 * @since 1.0.0
 */
public class ReflectUtils {

    public static Type[] parseParameterizedType(Class clazz) {
        Type genericSuperclass = clazz.getGenericSuperclass();
        if (genericSuperclass instanceof ParameterizedType) {
            ParameterizedType parameterizedType = (ParameterizedType) genericSuperclass;
            Type[] actualTypeArguments = parameterizedType.getActualTypeArguments();
            return actualTypeArguments;
        }
        return null;
    }

    public static void main(String[] args) {
    }
}
